package web.pre;

import java.io.IOException;
import java.util.List;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import entity.Easybuy_news;
import service.EasyBuyNewsService;
import service.Impl.EasyBuyNewsServiceImpl;

/**
 * Servlet implementation class InfromactionList
 */
public class InfromactionList extends HttpServlet {
	
	protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
		request.setCharacterEncoding("utf-8");
		response.setContentType("text/html;charset=utf-8");
			int count =Integer.parseInt(request.getParameter("count"));
			
			EasyBuyNewsService service =new EasyBuyNewsServiceImpl();
			
			List<Easybuy_news> news=service.InformationList(count);
			
			int result=service.count();
			int total=result/8;
			if (total%8!=0) {
				total+=1;
			}
			request.setAttribute("count", count);
			request.setAttribute("newss", news);
			request.setAttribute("total", total);
			request.getRequestDispatcher("Member_newsList.jsp").forward(request,response);
		
		
		
	}

	/**
	 * @see HttpServlet#doPost(HttpServletRequest request, HttpServletResponse response)
	 */
	protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
		// TODO Auto-generated method stub
		doGet(request, response);
	}

}
